<?php

// 将路由中.转换成-
if (! function_exists('route_class'))
{
    function route_class()
    {
        return str_replace('.', '-', Route::currentRouteName());
    }

    function category_nav_active($category_id)
    {
        return active_class((if_route('categories.show') && if_route_param('category', $category_id)), 'layui-this');
    }

    //生成文章的摘要
    function make_excerpt($value, $length = 200)
    {
        $excerpt = trim(preg_replace('/\r\n|\r|\n+/', ' ', strip_tags($value)));
        return Str::limit($excerpt, $length);
    }
}
